package com.evan.review.thread;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.evan.review.R;

/**
 * Main entry point for thread-related examples
 */
public class ThreadMainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_thread_main);
        
        // Thread basics
        Button btnThreadBasics = findViewById(R.id.btn_thread_basics);
        btnThreadBasics.setOnClickListener(v -> {
            Intent intent = new Intent(this, ThreadExampleActivity.class);
            startActivity(intent);
        });
        
        // Thread pools
        Button btnThreadPool = findViewById(R.id.btn_thread_pool);
        btnThreadPool.setOnClickListener(v -> {
            Intent intent = new Intent(this, ThreadPoolActivity.class);
            startActivity(intent);
        });
        
        // Thread pool parameters
        Button btnThreadPoolParams = findViewById(R.id.btn_thread_pool_params);
        btnThreadPoolParams.setOnClickListener(v -> {
            Intent intent = new Intent(this, ThreadPoolParamsActivity.class);
            startActivity(intent);
        });
        
        // Thread safety
        Button btnThreadSafety = findViewById(R.id.btn_thread_safety);
        btnThreadSafety.setOnClickListener(v -> {
            Intent intent = new Intent(this, ThreadSafetyDemoActivity.class);
            startActivity(intent);
        });
        
        // Thread documentation
        Button btnThreadDoc = findViewById(R.id.btn_thread_doc);
        btnThreadDoc.setOnClickListener(v -> {
            // Since ThreadDoc is just a documentation class, show a dialog with info
            new androidx.appcompat.app.AlertDialog.Builder(this)
                    .setTitle("线程文档")
                    .setMessage("ThreadDoc.java包含了关于Android中线程和线程池的全面文档，" +
                            "涵盖了线程基础知识、线程池、Android特有的线程机制以及常见面试问题。\n\n" +
                            "请在IDE中打开此文件查看完整文档。")
                    .setPositiveButton("确定", null)
                    .show();
        });
    }
} 